<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"  xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="_header_include::frag(~{::title},~{::style},~{})">
    <title>后台管理系统</title>
    <style>
        .tableBox a{color:#5c6be8 }
    </style>
</head>
<body>
<div id="clueManage" class="clueManage mainPadding" style="display: none;">
    <el-breadcrumb separator="/" class="elBreadcrumb marginB20">
        <el-breadcrumb-item>Home</el-breadcrumb-item>
        <el-breadcrumb-item>财务管理</el-breadcrumb-item>
        <el-breadcrumb-item>对账结算申请</el-breadcrumb-item>
    </el-breadcrumb>

    <el-row class="marginB20 ">
    		<el-button type="primary" @click="dialogFormVisible = true"><i class="el-icon-menu"></i>选择列</el-button>
    		<shiro:hasPermission name="financing:balanceaccountManager:rejectApply">
		    	<el-button type="danger" @click="rejectback">驳回</el-button>
		    </shiro:hasPermission>
    		<shiro:hasPermission name="financing:balanceaccountManager:settlementConfirm">
		    	<el-button type="warning" @click="settlementConfirmButton">提交对账确认</el-button>
		    </shiro:hasPermission>
			<el-button type="success" @click="down">下载结算单</el-button>
			<shiro:hasPermission name="financing:balanceaccountManager:export">
	            <el-button type="warning" @click="exportFun"><i ></i>导出签约数据</el-button>
	        </shiro:hasPermission>
	  </el-row>
	  <div class="mainSearchBg">
        <div class="mainSearchFormBox">
            <el-form :inline="true" :model="searchForm" class="demo-form-inline mainSearchForm" ref="searchForm">
                <el-form-item label="商务大区:"  prop="busAreaId">
                  <el-select v-model="searchForm.busAreaId" clearable filterable  placeholder="商务大区" @change="changeBusArea"  @clear="clearBusAreaList" >
                    <el-option
                      v-for="item in busAreaOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                  </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="签单商务组:"  prop="busGroupId">
                  <el-select v-model="searchForm.busGroupId" clearable filterable placeholder="签单商务组"  @change="changeBusGroup"  @clear="clearBusGroupList">
                    <el-option
                      v-for="item in busGroupOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                  </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="签单商务经理:"  prop="busSaleId">
                  <el-select v-model="searchForm.busSaleId" clearable filterable placeholder="签单商务经理">
                    <el-option
                      v-for="item in busSaleOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                  </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="签约时间：">
                  <el-date-picker  v-model="searchForm.startTime" format="yyyy-MM-dd HH:mm" type="datetime" placeholder="选择日期"></el-date-picker>
                </el-form-item>
                <el-form-item label="—" class="widthauto">
                <el-date-picker  v-model="searchForm.endTime" format="yyyy-MM-dd HH:mm" type="datetime" placeholder="选择日期"></el-date-picker>
                </el-form-item>

                <el-row v-show="isShow">
                    <el-form-item label="处理状态:"  prop="status">
                      <el-select v-model="searchForm.status" clearable placeholder="处理状态">
                        <el-option
                          v-for="item in statusOptions"
                          :key="item.value"
                          :label="item.name"
                          :value="item.value">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="签约项目:"  prop="signProjectId">
                      <el-select v-model="searchForm.signProjectId" clearable filterable placeholder="签约项目">
                        <el-option
                          v-for="item in projectOptions"
                          :key="item.id"
                          :label="item.projectName"
                          :value="item.id">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="客户姓名:" prop="cusName">
                      <el-input v-model="searchForm.cusName" placeholder="客户姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="付款时间：">
                      <el-date-picker  v-model="searchForm.payStartTime" format="yyyy-MM-dd HH:mm" type="datetime" placeholder="选择日期"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="—" class="widthauto">
                      <el-date-picker  v-model="searchForm.payEndTime" format="yyyy-MM-dd HH:mm" type="datetime" placeholder="选择日期"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="电销分公司:">
	                    <el-select v-model="searchForm.teleCompanyId" @change="showTele(7)" placeholder="电销分公司" clearable filterable>
	                        <el-option
	                                v-for="item in dxBusinessList"
	                                :key="item.id"
	                                :label="item.name"
	                                :value="item.id">
	                        </el-option>
	                    </el-select>
	                </el-form-item>
                    <el-form-item label="电销事业部:"  prop="teleDeptId">
                      <el-select v-model="searchForm.teleDeptId" clearable filterable  placeholder="电销事业部" @change="showTele(1)"  @clear="clearTeleDeptList">
                        <el-option
                          v-for="item in teleDeptOptions"
                          :key="item.id"
                          :label="item.name"
                          :value="item.id">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="电销组:"  prop="teleGorupId">
                      <el-select v-model="searchForm.teleGorupId" clearable filterable @change="changeTeleGroup" placeholder="电销组" @clear="clearTeleGroupList">
                        <el-option
                          v-for="item in teleGorupOptions"
                          :key="item.id"
                          :label="item.name"
                          :value="item.id">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="电销顾问:"  prop="teleSaleId">
                      <el-select v-model="searchForm.teleSaleId" clearable filterable placeholder="电销顾问">
                        <el-option
                          v-for="item in teleSaleOptions"
                          :key="item.id"
                          :label="item.name"
                          :value="item.id">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="签约省份:"  prop="signProvince">
                      <el-select v-model="searchForm.signProvince" clearable filterable  placeholder="签约省份">
                        <el-option
                          v-for="item in provinceOptions"
                          :key="item.name"
                          :label="item.name"
                          :value="item.name">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="付款类型:"  prop="payType">
                      <el-select v-model="searchForm.payType" clearable placeholder="付款类型">
                        <el-option
                          v-for="item in payTypeOptions"
                          :key="item.value"
                          :label="item.name"
                          :value="item.value">
                      </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="客户联系方式:" prop="phone">
                      <el-input v-model="searchForm.phone" placeholder="客户联系方式"></el-input>
                    </el-form-item>
                    <el-form-item label="结算单编号:" prop="statementNo">
                        <el-input v-model="searchForm.statementNo" placeholder="结算单编号"></el-input>
                    </el-form-item>
                    <el-form-item label="签约单编号:" prop="signNo">
                      <el-input v-model="searchForm.signNo" placeholder="签约单编号"></el-input>
                    </el-form-item>

                </el-row>
                <div class="mainSearchBtnBox">
                    <el-button icon="el-icon-search" type="primary" @click="searchTable()" class="searchBtn">搜索</el-button>
                    <!-- <el-button type="info" class="searchBtn">取消</el-button> -->
                    <span style="color: #5c6be8;cursor: pointer;margin:0 10px;" @click="toogleClick"><span v-if="isShow">收起</span><span v-else>展开更多</span><i :class="{'greycolor paddingL6 el-icon-arrow-up':isShow,'greycolor paddingL6 el-icon-arrow-down':!isShow}"></i></span>
                </div>
            </el-form>
        </div>
        <el-row>
            <el-table class="tableBox" ref="multipleTable" tooltip-effect="dark" border  @selection-change="handleSelectionChange" style="width: 100%" :data="dataTable">
               <el-table-column align="center" type="selection" label="全选" width="55"></el-table-column>
               <el-table-column align="center" type="index" label="序号" width="55"></el-table-column>

               <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-for="(item,key,index) in tableColums" v-if="item.fieldCode == 'isDoubt'">
    	               <template slot-scope="scope">
               		  	<div v-if="scope.row.isDoubt === 1">
                            <el-button type="text" size="small" @click="viewDoubt(scope.row)">
                            	查看疑意
                            </el-button>
                        </div>
                    </template>
    	        </el-table-column>
    	        <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
    	         v-else-if="item.fieldCode == 'status'">
    	               <template slot-scope="scope">
               		  	<div v-if="scope.row.status ==='驳回商务'">
                            <el-button type="text" size="small" @click="backRemark(scope.row)">
                            	驳回原因
                            </el-button>
                        </div>
                    </template>
    	        </el-table-column>
    	        <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
    	         v-else-if="item.fieldCode == 'statementNo'">
    	               <template slot-scope="scope">
    	               <div v-if="scope.row.status !='驳回商务' && scope.row.status !='待处理'">
    	               	<a :href="'/financing/balanceaccount/settleAccounts?payDetailId='+scope.row.payId+''" target="_blank" class="blueColorBtn">{{scope.row.statementNo}} </a>
    	               </div>
    	           <div v-else-if="scope.row.status =='驳回商务' || scope.row.status =='待处理'">
    	               	<a style="color:#222">{{scope.row.statementNo}} </a>
    	               </div>

                    </template>
    	        </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'showReviewImages'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.showReviewImages === 1 ">
                            <el-button type="text" size="small" @click="showReviewImageClick(scope.row)">点击查看<span style="color:red;">({{scope.row.reviewImagesNum}})</span> </el-button>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
    	         	v-else>
    	        </el-table-column>
            </el-table>
            <table-pagination v-if="paginationShow" :pager="pager" @change="searchTable"></table-pagination>
        </el-row>
    </div>
    <!--查看疑意-->
    <el-dialog title="查看疑意" :visible.sync="viewDoubtVisable" width="50%" v-dialog-drag>
        <template>
            <el-form :model="viewDoubtForm" ref="viewDoubtForm">
                <el-form-item label="" :required="true">
                    <div class="lineFeed">{{viewDoubtForm.doubtRemark}}</div>
                </el-form-item>
            </el-form>
        </template>
    </el-dialog>
    <!-- 查看签约/开店图片 -->
    <el-dialog title="签约/开店图片" :visible.sync="showReviewImagesDialog" width="1000px" >
        <el-table ref="multipleTable" :data="tableDataC1" tooltip-effect="dark" style="width: 100%" border  v-loadi>
            <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
            <el-table-column prop="uploadUserName" label="上传人姓名" align="center"></el-table-column>
            <el-table-column prop="uploadTime" label="上传时间" align="center"></el-table-column>
            <el-table-column prop="fileName" label="文件名称" align="center"></el-table-column>
            <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" @click="handleOperateFn(scope.$index, scope.row)">
                        {{scope.row.fileType !=="jpg" && scope.row.fileType !=="png" && scope.row.fileType !=="jpeg" &&
                        scope.row.fileType !=="gif" && scope.row.fileType !=="bmp"? '下载录音':'查看图片'}}
                    </el-button>
                </template>
            </el-table-column>
            <el-table-column prop="delStatus" label="删除状态" align="center">
                <template slot-scope="scope">
                    <div v-if="scope.row.delStatus === 0">未删除</div>
                    <div v-else-if="scope.row.delStatus ===1" class="redcolor">已删除</div>
                </template>
            </el-table-column>
        </el-table>
    </el-dialog>
    <!-- 上传资源dialog -->
    <el-dialog title="查看图片" :visible.sync="dialogFormUploadImg" width="1100px">
        <div class="padding20" style="text-align: center;">
            <img :src="dialogFormUploadImgSrc" alt="" max-width="1000px">
        </div>
    </el-dialog>

      <!--驳回原因-->
    <el-dialog title="驳回原因" :visible.sync="backVisable" width="540px" v-dialog-drag>
        <template>
            <el-form >
                <el-form-item label="" >
                    <div class="lineFeed">{{backRemarks}}</div>
                </el-form-item>
            </el-form>
        </template>
    </el-dialog>
    <el-dialog title="自定义列" :visible.sync="dialogFormVisible" class="elCheckboxGroup">
	  <el-form :model="form">

		  <el-form-item label="" prop="type">
		    <el-checkbox-group v-model="form.type">
		      <el-checkbox :label="item.sortNum+'_'+item.fieldCode+'_'+item.displayName+'_'+item.id+'_'+item.width"  name="type" :key="item.fieldCode"  v-for="(item,index) in  allTableColums ">
		          {{item.displayName}}
		      </el-checkbox>

		     </el-checkbox-group>
		  </el-form-item>

	  </el-form>

	  <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirmColumn">确 定</el-button>
	    <el-button @click="dialogFormVisible = false">取 消</el-button>
	  </div>
	</el-dialog>
	 <!--驳回-->
    <el-dialog title="提示" :visible.sync="rejectVisible" width="540px" @close="closeRejectDialog" v-dialog-drag>
        <template>
            <el-form :model="rejectform" ref="rejectform" :rules="notVisitFlagRules">
                <el-form-item label="确定要将此结算单:" >
                    <!--<el-button type="text" disabled style="color: #1e2746; width:100px; word-wrap:break-word; word-break:normal;">{{notVisitFlag.str}}</el-button>-->
                    <span style=" display: block; color: #1e2746; ">{{backQuery}}</span>
                </el-form-item>
                <el-form-item label="驳回原因:" label-width="70px" prop="remark">
                    <el-input type="textarea" v-model="rejectform.remark" maxlength="100" :rows="3" placeholder="请输入内容(限制100字)"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer" style="text-align:center;">
                <el-button type="primary" :disabled="btnDisabled" @click="reconciliationConfirm('rejectform')">确定</el-button>
                <el-button @click="cancelReconciliationFrom('rejectform')">取消</el-button>
            </div>
        </template>
    </el-dialog>
    <!-- dialog -->
    <el-dialog title="提交对账确认" :visible.sync="submitApplyVisible" width="540px" @close="closeSubmitApplyDialog" v-dialog-drag>
        <el-form :model="apply" ref="apply" :rules="allpyrules" class="width500">
	        <el-form-item label="结算金额：" :label-width="formLabelWidth1" prop="money">
	             <el-input  type="number" v-model="apply.money" placeholder="" style="width: 290px;margin-right: 10px;" oninput="if(value.length>8)value=value.slice(0,8)" @input="repeatApplyNumber" maxLength="10"></el-input>元
	         </el-form-item>
	         <el-form-item label="是否有疑意："   :label-width="formLabelWidth1" prop="isDoubt">
	          <el-radio-group @change="isdoubtbutton" v-model="apply.isDoubt">
	          	<el-radio  :label="0">否</el-radio>
	             <el-radio  :label="1">是</el-radio>
	          </el-radio-group>

	         </el-form-item>
	         <el-form-item label="疑意：" prop="doubtRemark" :label-width="formLabelWidth1" v-show="doubtRemarkShow">
	                    <el-input type="textarea" v-model="apply.doubtRemark" maxlength="100" :rows="3" placeholder="请填写疑意" style="width: 290px;"></el-input>
	                </el-form-item>
	          <el-form-item label="结算比例：" :label-width="formLabelWidth1" ><span style="color: red;">{{ratio}}%</span>
	          </el-form-item>
	          <el-form-item label="佣金："  :label-width="formLabelWidth1">
              <!-- <span style="color: red;">{{commissionMoney}}</span> -->
              <el-input  type="number" v-model="apply.commissionMoney" placeholder="" style="width: 290px;margin-right: 10px;" oninput="if(value.length>8)value=value.slice(0,8)"  maxLength="10"></el-input>元
	          </el-form-item>
            <div v-if="lowestCommissionShow">
                <el-form-item label="保底服务费：" :label-width="formLabelWidth1"><span style="color: red;">{{lowestCommission}}</span>
                </el-form-item>
                <el-form-item label="已对账确认佣金：" :label-width="formLabelWidth1"><span style="color: red;">{{confirmCommission}}</span>
                </el-form-item>
            </div>
          </el-form>
        <div slot="footer" style="text-align: center" class="dialog-footer">
            <el-button type="primary" :disabled="btnDisabled" @click="settlementConfirm('apply')">提交</el-button>
            <el-button @click="cancelSubmitApplyFrom('apply')">取消</el-button>
        </div>
    </el-dialog>
</div>
<!-- import common js-->
<script th:src="@{/js/custom/callrecord/download.js?v=1.0.0}"></script>
<div th:include="_footer_include :: #jsLib"></div>
</body>
<script th:inline="javascript">
var busAreaList=[[${busAreaList}]];//商务大区
var busGroupList=[[${busGroupList}]];//商务组
var busSaleList=[[${busSaleList}]];//商务经理
var teleDeptList=[[${teleDeptList}]];//电销事业部
var teleGroupList=[[${teleGroupList}]];//电销组
var teleSaleList=[[${teleSaleList}]];//电销顾问
var provinceList=[[${provinceList}]];//省份
var projectList=[[${projectList}]];//项目
var fieldList=[[${fieldList}]];//自定义字段
var userFieldList=[[${userFieldList}]];//用户自定义字段
var vistitStoreTypeList=[[${vistitStoreTypeList}]];//签约店型
console.log(vistitStoreTypeList,"vistitStoreTypeList")
var payModeItem =[[${payModeItem}]];
var giveTypeList =[[${giveTypeList}]];
var businessLine = [[${businessLine}]];
var clueVM = new Vue({
        el: '#clueManage',
        data: {
            dialogFormUploadImg: false, //上传资源图片弹框
            dialogFormUploadImgSrc: '', //上传资源图片弹框
            showReviewImagesDialog:false,
            tableDataC1: [],//文件记录
            paginationShow: false,
            isShow:false,
            lowestCommissionShow: false,
            btnDisabled: false,
        	searchForm: {
        		teleCompanyId:'',
  	       		busAreaId: '',
  	       		busGroupId: '',
  	       		busSaleId: '',
  	       		status: 0,
  	       		signProjectId: '',
  	       		cusName: '',
  	       		teleDeptId: '',
  	       		teleGorupId: '',
  	       		teleSaleId: '',
  	       		signProvince: '',
  	       		payType: '',
  	       		phone: '',
  	       		startTime: '',
  	       		endTime: '',
  	       		payStartTime: '',
  	       		payEndTime: '',
  	       		statementNo: '',
  	       		signNo: ''
            },
            businessLine:businessLine,
            confirmCommission:"",
            doubtRemarkShow:false,
            backRemarks:"",
            backVisable:false,
            submitApplyVisible:false,
            ratio:"",
            viewDoubtForm: {
            	doubtRemark: ''
            },
            rejectform:{
            	remark:""
            },
            backQuery:"",
            rejectVisible:false,
            count:0,
            dxBusinessList:[],
            dataTable:[],
            allTableColums:[],
            tableColums:[],
            dialogFormVisible: false,
            apply: {
            	money: "",
            	isDoubt:"0",
            	doubtRemark:""
  	        },
  	        form: {
  	          	type: [],
  	        },
            busAreaOptions:busAreaList,
            busGroupOptions:busGroupList,
            busSaleOptions:busSaleList,
            teleDeptOptions:[],
            teleGorupOptions:teleGroupList,
            teleSaleOptions:teleSaleList,
            provinceOptions:provinceList,
            projectOptions:projectList,
            statusOptions:[{
            	value:0,
            	name:"待处理"
            },{
            	value:1,
            	name:"驳回商务"
            },{
            	value:2,
            	name:"提交对账"
            },{
            	value:3,
            	name:"已对账"
            },{
            	value:4,
            	name:"已结算"
            }],
            payTypeOptions:[{
            	value:1,
            	name:"全款"
            },{
            	value:2,
            	name:"定金"
            },{
            	value:3,
            	name:"追加定金"
            },{
            	value:4,
            	name:"尾款"
            }],
            pager:{
                total: 0,
                currentPage: 1,
                pageSize: 20,
            },
            allocationFormRules: {
            	  saleId: [
                    { required: true, message: '请选择商务经理', trigger: 'change' }
                ]
            },
            transferFormRules: {
              	saleId: [
                      { required: true, message: '请选择商务经理', trigger: 'change' }
                  ]
                },
                notVisitFlagRules: {
              	  remark: [
                        {required: true,min: 1, max: 100, message: '请输入驳回原因', trigger: 'blur'}
                    ],
                },
                allpyrules: {
                    money: [
                        {validator:function(rule,value,callback){
                            if(value==0 || value=="0"){
                                callback();
                            }else{
                          	  var reg =   /^[1-9]\d*$/;
                                if(value ==null || value =="null" || value ==""  ){
                                    callback(new Error("请输入结算金额"));
                                    clueVM.apply.money =null;

                                }else  if(value !=null && value !="null" && value !="" && !reg.test(value) ){
                                    callback(new Error("请输入正整数"));
                                    clueVM.apply.money =null;
                                }else{
                                    callback();
                                }

                            }

                        },required: true, trigger: 'change'}
                ],
                isDoubt: [
                    {required: true, message: '请选择是否有疑意', trigger: 'change'}
                ],
                doubtRemark: [
              	  {validator:function(rule,value,callback){
                        if(clueVM.apply.isDoubt ==0){
                      	  callback();
                        }else{
                      	  var reg =   /^[1-9]\d*$/;
                            if(value ==null || value =="null" || value ==""  ){
                                callback(new Error("请输入疑意内容"));
                                clueVM.apply.doubtRemark =null;

                            }else{
                                callback();
                            }
                        }

                    }, required: true,trigger: 'change'}
                ]
            },
            multipleSelection:[],
            viewDoubtVisable:false,
            formLabelWidth: '150px',
            formLabelWidth1: '130px',
            storeForm: {
                busAreaId: '',
                busGroupId: '',
                busSaleId: '',
                status: '',
                signProjectId: '',
                cusName: '',
                teleDeptId: '',
                teleGorupId: '',
                teleSaleId: '',
                signProvince: '',
                payType: '',
                phone: '',
                startTime: '',
                endTime: '',
                payStartTime: '',
                payEndTime: '',
                statementNo: '',
                signNo: ''
            },
            storeId: '',
            scrollTop: 0,
        },
        methods: {
            showReviewImageClick(row) {
                var param = {};
                param.signId = row.signId;
                axios.post('/businesssign/findFileBySignId', param).then(function (response) {
                    clueVM.tableDataC1 = response.data.data;
                    clueVM.showReviewImagesDialog = true;
                })  .catch(function (error) {
                    console.log(error);
                });

            },
            handleOperateFn(index, row) { //上传资源"查看图片,下载录音"

                if (row.fileType == 'mp3'|| row.fileType == 'mp4' || row.fileType == 'wav' || row.fileType == 'wma'|| row.fileType == '3gpp' || row.fileType == 'm4a' ||row.fileType == 'ape'|| row.fileType == 'midi' || row.fileType == 'amr'|| row.fileType == 'MP3'|| row.fileType == 'MP4' ||row.fileType == 'WAV' || row.fileType == 'WMA'|| row.fileType == '3GPP' || row.fileType == 'M4A' ||row.fileType == 'APE'|| row.fileType == 'MIDI' || row.fileType == 'AMR') {
                    var x = new XMLHttpRequest();
                    x.open("GET", row.filePath, true);
                    x.responseType = 'blob';
                    x.onload = function (e) {
                        download(x.response, row.fileName, "audio/mp3");
                    };
                    x.send();
                } else {
                    this.dialogFormUploadImgSrc = row.filePath;
                    this.dialogFormUploadImg = true;
                }

            },
          	isdoubtbutton(){
          		if(clueVM.apply.isDoubt==1){
          			this.doubtRemarkShow = true;
          		}else{
          			this.doubtRemarkShow = false;
          		}

          	},
          	searchTable() {
                var param ={};
                var startTime = this.searchForm.startTime;
                var endTime = this.searchForm.endTime;
                var payStartTime = this.searchForm.payStartTime;
                var payEndTime = this.searchForm.payEndTime;
            	  var vilad=false;
                if(startTime&&endTime&&startTime> endTime){
                	vilad=true;
                }
                if(payStartTime&&payEndTime&&payStartTime> payEndTime){
                	vilad=true;
                }
                if(vilad){
                	this.$message({
                        message: '开始时间不能大于结束时间',
                        type: 'warning'
                      });
                    return;
                }
                param.startTime = startTime;
                param.endTime = endTime;
                param.payStartTime = payStartTime;
                param.payEndTime = payEndTime;
                param.pageSize = this.pager.pageSize;
                param.pageNum = this.pager.currentPage;
                param.busAreaId = this.searchForm.busAreaId;
                param.busGroupId = this.searchForm.busGroupId;
                param.busSaleId = this.searchForm.busSaleId;
                param.status = this.searchForm.status;
                param.signProjectId = this.searchForm.signProjectId;
                param.cusName = this.searchForm.cusName;
                param.teleCompanyId = this.searchForm.teleCompanyId;
                param.teleDeptId = this.searchForm.teleDeptId;
                param.teleGorupId = this.searchForm.teleGorupId;
                param.teleSaleId = this.searchForm.teleSaleId;
                param.signProvince = this.searchForm.signProvince;
                param.payType = this.searchForm.payType;
                param.phone = this.searchForm.phone;
                param.signNo = this.searchForm.signNo;
                param.statementNo = this.searchForm.statementNo;

                //列表只查询正常数据，取消删除数据不查询
                //param.delFalg = this.searchForm.delFalg;
                console.info(param);
                axios.post('/financing/balanceaccount/applyList', param)
                .then(function (response) {
                    var result =  response.data;
                    console.info(result);
                    var table=result.data;
                    clueVM.pager.total =  table.total;
                    clueVM.pager.currentPage = table.currentPage;

                    var data= table.data;
                    for(var i=0;i<data.length;i++){
                  	  data[i].status=clueVM.transformStatus(null,null,data[i].status,null);
                  	  data[i].signType=clueVM.transformSignType(null,null,data[i].signType,null);
                  	  data[i].signShopType=clueVM.transformSignShopType(null,null,data[i].signShopType,null);
                  	  data[i].payType=clueVM.transformPayType(null,null,data[i].payType,null);
                  	  data[i].payMode=clueVM.transformPayMode(null,null,data[i].payMode,null);
                  	  data[i].isRemoteSign=clueVM.transformSex(null,null,data[i].isRemoteSign,null);
                  	  data[i].ratio=clueVM.transformratio(null,null,data[i].ratio,null);
                  	  data[i].payTime = clueVM.dateFormat(null,null,data[i].payTime,null);
                        data[i].vistitTime = clueVM.dateFormat(null,null,data[i].vistitTime,null);
                    }
                    clueVM.dataTable= data;

                    // 取出存储的id
                    if(!clueVM.paginationShow){
                       if(clueVM.storeId){
                           clueVM.$nextTick(function(){
                              var storage = [];
                              clueVM.dataTable.forEach(function(item, index){
                                  if(item.accountId === clueVM.storeId ){
                                      storage.push(clueVM.dataTable[index]);
                                  }
                              })
                              clueVM.toggleSelection(storage);
                              clueVM.$el.querySelector('.el-table__body-wrapper').scrollTop = clueVM.scrollTop;
                          })
                      }
                    }else{
                      removeSessionStore ("balanceAccountStoreForm");
                      removeSessionStore ("balanceAccountOtherVal");
                    }
                    clueVM.paginationShow = true;
                    clueVM.storeForm = clueVM.searchForm;

                })
                .catch(function (error) {
                     console.log(error);
                });

              },
              toggleSelection(rows) { // table select 默认选中fn
                  if (rows) {
                      rows.forEach(row => {
                          this.$refs.multipleTable.toggleRowSelection(row,true);
                      });
                  } else {
                      this.$refs.multipleTable.clearSelection();
                  }
              },
              //选择行
              handleSelectionChange(val) {
                  this.multipleSelection = val;
              },
              handleSizeChange(val) {
                  //下拉框  每页 10,20条切换 调用
                     console.log(`每页 ${val} 条`);
                  this.pageSize = val;
                  this.initTableData(1);
               },
               handleCurrentChange(val) {
                   //点击 页码
                 console.log(`当前页: ${val}`);
                 this.initTableData(val);
               },
               exportFun(){
            	   var param ={};
                   var startTime = this.searchForm.startTime;
                   var endTime = this.searchForm.endTime;
                   var payStartTime = this.searchForm.payStartTime;
                   var payEndTime = this.searchForm.payEndTime;
               	  var vilad=false;
                   if(startTime&&endTime&&startTime> endTime){
                   	vilad=true;
                   }
                   if(payStartTime&&payEndTime&&payStartTime> payEndTime){
                   	vilad=true;
                   }
                   if(vilad){
                   	this.$message({
                           message: '开始时间不能大于结束时间',
                           type: 'warning'
                         });
                       return;
                   }
                   param.startTime = startTime;
                   param.endTime = endTime;
                   param.payStartTime = payStartTime;
                   param.payEndTime = payEndTime;
                   param.pageSize = this.pager.pageSize;
                   param.pageNum = this.pager.currentPage;
                   param.busAreaId = this.searchForm.busAreaId;
                   param.busGroupId = this.searchForm.busGroupId;
                   param.busSaleId = this.searchForm.busSaleId;
                   param.status = this.searchForm.status;
                   param.signProjectId = this.searchForm.signProjectId;
                   param.cusName = this.searchForm.cusName;
                   param.teleCompanyId = this.searchForm.teleCompanyId;
                   param.teleDeptId = this.searchForm.teleDeptId;
                   param.teleGorupId = this.searchForm.teleGorupId;
                   param.teleSaleId = this.searchForm.teleSaleId;
                   param.signProvince = this.searchForm.signProvince;
                   param.payType = this.searchForm.payType;
                   param.phone = this.searchForm.phone;
                   param.signNo = this.searchForm.signNo;
                   param.statementNo = this.searchForm.statementNo;
                   param.pageNum='';
                   param.pageSize='';
                   axios.post('/financing/balanceaccount/export',param,{responseType:'blob'})
                   .then(function (response) {
                       console.log(response)
                       var data =  response.data;
                       var fileName = response.headers.filename;
                           saveAs(data,decodeURI(fileName));
                   })
                   .catch(function (error) {
                       console.log(error);
                   }).then(function(){
                	   clueVM.loading=false;
                   });                     	
               	
               },
             //日期数据格式化方法
       		dateFormat(row, column, cellValue, index) {
                  	if (cellValue == undefined) {
       	               return "";
                 	}
                  	return moment(cellValue).format("YYYY-MM-DD");
       		},
               //
               transformratio(row, column, cellValue, index) {

                 return (cellValue+"").substring(0,2)+"%";
               },
               //是否转换方法
               transformSex(row, column, cellValue, index) {
                 var text="";
                 if(cellValue=="1"){
                   text="是"
                 }else if(cellValue=="0"){
                   text="否"
                 }
                 return text;
               },
               //签约类型转换方法
               transformSignType(row, column, cellValue, index) {
                 var text="";
                 if(cellValue=="1"){
                   text="一次性全款"
                 }else if(cellValue=="2"){
                   text="先交定金"
                 }
                 return text;
               },
               //付款类型转换方法
               transformPayType(row, column, cellValue, index) {
                 var text="";
                 if(cellValue=="1"){
                   text="全款"
                 }else if(cellValue=="2"){
                   text="定金"
                 }else if(cellValue=="3"){
                   text="追加定金"
                 }else if(cellValue=="4"){
                   text="尾款"
                 }
                 return text;
               },
               //付款方式转换方法
               transformPayMode(row, column, value, index) {
                 var valText="";
                 if(!value){
                   return valText;
                 }
                 var vals = value.split(",");
                 if(payModeItem){
                   for(var j = 0 ; j < vals.length;j++  ){
                     for(var i = 0; i < payModeItem.length ; i++){
                       if(payModeItem[i].value == vals[j]){
                         if(j==0){
                           valText += payModeItem[i].name;
                         }else{
                           valText += ","+payModeItem[i].name;
                         }
                       }
                     }
                   }
                 }
                 return valText;
               },

              transGiveType(row, column, value, index) {
                var text="";
                for(var i=0;i<giveTypeList.length;i++) {
                  if(giveTypeList[i].value ==value){
                    text = giveTypeList[i].name;
                  }
                }
                return text;
              },
               //处理状态转换方法
               transformStatus(row, column, cellValue, index) {
                 var text="";
                 if(cellValue=="0"){
                     text="待处理";
                 }else if(cellValue=="1"){
                     text="驳回商务";
                 }else if(cellValue=="2"){
                   text="提交对账";
                 }else if(cellValue=="3"){
                   text="已对账";
                 }else if(cellValue=="4"){
                   text="已结算";
                 }else{
                   text="未提交对账";
                 }
                 return text;
               },
               //店型转换方法
               transformSignShopType(row, column, cellValue, index) {
             	  var text="";
             	  if(vistitStoreTypeList){
 	                  for(var i=0;i<vistitStoreTypeList.length;i++){
 	                		if(cellValue==vistitStoreTypeList[i].value){
 	                			text=vistitStoreTypeList[i].name;
 	                		}
 	                	}
             	  }
                   return text;
               },
               down(){
            	   var rows = this.multipleSelection;
            	   if(rows.length ==0){
                       this.$message({
                          message: '请选择数据',
                          type: 'warning'
                        });
                       return;
                   } else if(rows.length>1){
                       this.$message({
                          message: '请选择一条数据进行下载结算单',
                          type: 'warning'
                        });
                       return;
                   }
            	   var status = rows[0].status;
            	   if(status =="待处理" || status =="驳回商务" ){
            		   this.$message({
                           message: "未提交对账不允许下载结算单",
                           type: 'warning'
                         });
                        return;
            	   }
            	   window.location.href="/financing/balanceaccount/downBalanceAccount?payDetailId="+rows[0].payId;
               },
               //驳回
               rejectback() {
           	       var rows = this.multipleSelection;
            	   if(rows.length ==0){
                       this.$message({
                          message: '请选择数据',
                          type: 'warning'
                        });
                       return;
                   }else if(rows.length !=1){
                       this.$message({
                          message: '请选择一条数据进行驳回',
                          type: 'warning'
                        });
                       return;
                   }
            	   var status = rows[0].status;
            	   var statementNo = rows[0].statementNo;
            	   var payTime = rows[0].payTime;
            	   var msg = "只有待处理的申请允许驳回！";
            	   /*if(status !="待处理"){
            		   this.$message({
                           message: msg,
                           type: 'warning'
                         });
                        return;
            	   }*/
            	   this.rejectVisible = true;
	               this.backQuery = "【"+statementNo+"】 付款时间："+payTime+" 驳回吗?";
                 // 存储选中信息--start
                  var clueId=rows[0].accountId;
                  setSessionStore("balanceAccountStoreForm", this.storeForm);
                  var otherVal = {
                      "currentPage": this.pager.currentPage,
                      "clueId": clueId,
                      "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
                  }
                  setSessionStore("balanceAccountOtherVal", otherVal);
                  // 存储选中信息--end
               },
               //驳回
               reconciliationConfirm(formName) {
            	   this.$refs[formName].validate((valid) => {
                       if (valid) {
                    	   var rows = this.multipleSelection;
                    	   var idList = [];
           	               for(var i=0;i<rows.length;i++){
           	            	   var curRow = rows[i];
           	            	   idList.push(curRow.accountId);
           	               }
           	          //对账确认
       	            	var param  = {};
                          param.idList=idList;
          	           		param.remark = this.rejectform.remark;
          	           		param.payDetailId=rows[0].payId;
                           param.signId = rows[0].signId;
                          this.btnDisabled = true;
                          axios.post('/financing/balanceaccount/rejectApply',param)
                             .then(function (response) {
                                 var data =  response.data;
                                 if(response.status==200){
                                 	clueVM.$message({message:'驳回成功',type:'success',duration:1000,onClose:function(){
                                    clueVM.btnDisabled = false;
                                    clueVM.rejectVisible = false;
                                    clueVM.searchTable();
                                 //		window.location.href="/financing/balanceaccount/balanceAccountPage";
                             	    }});
                                 }else{
                                 	clueVM.$message({
                                         message: "接口调用失败",
                                         type: 'error'
                                       });
                                       clueVM.btnDisabled = false;
                                 }
                             })
                             .catch(function (error) {
                               console.log(error);
                               clueVM.$message({
                                  message: "驳回失败",
                                  type: 'error'
                                });
                               clueVM.btnDisabled = false;
                             })
                             .then(function () {

                             });
                       }
            	   })


               },
               settlementConfirmButton(){
            	   var rows = this.multipleSelection;
            	   if(rows.length ==0){
                       this.$message({
                          message: '请选择数据',
                          type: 'warning'
                        });
                       return;
                   }else if(rows.length >1){
                          this.$message({
                             message: '请选择一条数据提交对账确认',
                             type: 'warning'
                           });
                          return;
                   }
            	   var status = rows[0].status;
            	   var statementNo = rows[0].statementNo;
            	   var payTime = rows[0].payTime;
            	   var msg = "";
            	   if(status =="驳回商务"){
            		   msg = "该申请处于驳回商务状态，不允许提交对账"
            	   }else if(status =="已结算"){
            		   msg = "该申请处于已结算状态，不允许提交对账"
            	   }
            	   if(msg !=""){
            		   this.$message({
                           message: msg,
                           type: 'warning'
                         });
                        return;
            	   }

                   this.ratio = rows[0].ratio.substring(0,2) ;
                   var parm = {};
                   parm.id = rows[0].payId;
                   if(status=="提交对账" || status=="已对账"){
                       axios.post('/financing/balanceaccount/getSettlementAmount', parm).then(function (response) {
                           if (null != response || response.data != null || response.data.code == '0') {
                               clueVM.apply.money = response.data.data ;
                           }
                       });
                       this.apply.commissionMoney = null;
                       this.apply.isDoubt = rows[0].isDoubt ;
                       this.apply.commissionMoney = rows[0].commissionMoney ;
                       if(rows[0].isDoubt ==1){
                           this.doubtRemarkShow = true;
                           this.apply.doubtRemark = rows[0].doubtRemark ;
                       }else{
                           this.doubtRemarkShow = false;
                           this.apply.doubtRemark = null;
                       }
                   }else{
                       axios.post('/financing/balanceaccount/getSettlementAmount', parm).then(function (response) {
                           if (null != response || response.data != null || response.data.code == '0') {
                               //结算金额
                               var money = response.data.data;
                               clueVM.apply.money = response.data.data;
                               clueVM.apply.commissionMoney = money* clueVM.ratio / 100;
                           }
                       });
                       this.apply.isDoubt = 0 ;
                       this.apply.doubtRemark = null ;
                       this.doubtRemarkShow = false;
                   }
                   var lowestCommissionStr = rows[0].lowestCommissionStr;
                   if ((rows[0].payType == "全款" || rows[0].payType == "尾款") && lowestCommissionStr != "") {
                       var signId = rows[0].signId;
                       var parmMap = {};
                       parmMap.signId = signId;
                       clueVM.lowestCommissionShow = true;
                       clueVM.lowestCommission = lowestCommissionStr;
                       //根据签约id获取已对账确认的佣金
                       axios.post('/financing/balanceaccount/getConfirmCommission', parmMap).then(function (response) {
                           if (null != response || response.data != null || response.data.code == '0') {
                               clueVM.confirmCommission = response.data.data;
                           }
                       });
                      this.repeatApplyNumber();
                   }
                   //校验
                   if(rows[0].payType != "全款" && rows[0].payType != "定金"){
                       var signId = rows[0].signId;
                       var param = {};
                       param.signId = signId;
                       param.payDetailId=rows[0].payId;
                       axios.post('/financing/balanceaccount/validateBalance', param).then(function (response) {
                           var result =  response.data;
                           if(result.data == 1){
                               clueVM.$message({
                                   message: "当前签约单还有付款明细未提交对账",
                                   type: 'warning'
                               });
                               return;
                           }
                           clueVM.submitApplyVisible = true;
                       }).catch(function (error) {
                           console.log(error);
                       });
                   }else{
                       clueVM.submitApplyVisible = true;
                   }
               },
               //结算确认
               settlementConfirm(form) {
            	   var rows = this.multipleSelection;
            	   this.$refs[form].validate((valid) => {
                    if (valid) {
                      var idList = [];
                        for(var i=0;i<rows.length;i++){
                          var curRow = rows[i];
                          idList.push(curRow.accountId);
                        }
                      var param  = {};
                      param.idList=idList;
                      param.money = clueVM.apply.money;
                      param.isDoubt = clueVM.apply.isDoubt;
                      param.doubtRemark = clueVM.apply.doubtRemark;
                      param.ratio = clueVM.ratio;
                      param.commissionMoney =clueVM.apply.commissionMoney;
                      this.btnDisabled = true;
                        param.payDetailId = rows[0].payId;
                        param.signId=rows[0].signId;
                      axios.post('/financing/balanceaccount/settlementConfirm',param)
                        .then(function (response) {
                            var data =  response.data;
                            if(response.status==200){
                              clueVM.$message({message:'提交对账成功',type:'success',duration:1000,onClose:function(){
                                clueVM.btnDisabled = false;
                                clueVM.submitApplyVisible = false;
                                clueVM.searchTable();
                               // window.location.href="/financing/balanceaccount/balanceAccountPage";
                              }});
                            }else{
                              clueVM.$message({
                                message: "接口调用失败",
                                type: 'error'
                              });
                              clueVM.btnDisabled = false;
                            }
                        })
                        .catch(function (error) {
                          console.log(error);
                          clueVM.btnDisabled = false;
                        });
                      }
            	    })
                 // 存储选中信息--start
                  var clueId=rows[0].accountId;
                  setSessionStore("balanceAccountStoreForm", this.storeForm);
                  var otherVal = {
                      "currentPage": this.pager.currentPage,
                      "clueId": clueId,
                      "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
                  }
                  setSessionStore("balanceAccountOtherVal", otherVal);
                  // 存储选中信息--end
               },
               viewDoubt(row) {
                   // 查看疑意
                   clueVM.viewDoubtVisable = true;
                   clueVM.viewDoubtForm.doubtRemark = row.doubtRemark;
               },
               //驳回原因
               backRemark(row){
            	   clueVM.backVisable = true;
            	   clueVM.backRemarks = row.remark;
               },
               confirmColumn(){
                 	//处理用户选择的列
                 	console.info(this.form.type);
                 	if(this.form.type.length==0){
               		this.$message({
                           message: "请至少保留一列",
                           type: 'error'
                         });
               		return;
               	}
                 	this.dialogFormVisible = false;
                 	var customerShowColun = [];
                 	var customerColumn = this.form.type;
                 	customerColumn.sort(this.sortNumber);//对选择的列排序
                 	var idList=[];
                 	for(var i=0;i<customerColumn.length;i++){
                 		var curItem = customerColumn[i];
                 		var itemArr = curItem.split("_");
                 		var obj = {};
                 		obj.fieldCode=itemArr[1];
                 		obj.displayName=itemArr[2];
                 		obj.width=itemArr[4];
                 		customerShowColun.push(obj);
                 		idList.push(itemArr[3])
                 	}
                 	this.tableColums = customerShowColun;
                 	var param ={};
                   param.fieldIdList = idList;
                   param.menuCode = "financing:balanceaccountManager";
                   console.info(param);
                   if(idList.length!=0){
   	                axios.post('/customfield/customField/saveUserField', param)
   	                .then(function (response) {

   	                })
   	                .catch(function (error) {
   	                     console.log(error);
   	                });
                   }
                 },
                 initColumn(){
                 	//初始化table 列 和 用户自定义列
                 	this.allTableColums = fieldList;
                 	if(userFieldList.length!=0){
                 		var type=[];
                     	for(var i=0;i<userFieldList.length;i++){
                     		type.push(userFieldList[i].sortNum+'_'+userFieldList[i].fieldCode+'_'+userFieldList[i].displayName+'_'+userFieldList[i].fieldId+'_'+userFieldList[i].width)
                    	}
   	              	this.form.type = type;
   	              	this.confirmColumn();
                 	}else{
                 		var type=[];
                     	for(var i=0;i<fieldList.length;i++){
                     		type.push(fieldList[i].sortNum+'_'+fieldList[i].fieldCode+'_'+fieldList[i].displayName+'_'+fieldList[i].id+'_'+fieldList[i].width)
                    	}
   	              	this.form.type = type;
   	              	this.confirmColumn();
                 	}

                 },
                 sortNumber(a,b) {
                     //对数组中元素，按照数字 从小到大 排序
                     return a.split("_")[0] - b.split("_")[0];
                  },
                  saveNotVisit(){

                  },
            repeatApplyNumber() {
                var commissionMoney = clueVM.apply.money * this.ratio / 100;
                if (!this.lowestCommissionShow) {
                    clueVM.apply.commissionMoney = commissionMoney;
                }
                if (this.lowestCommissionShow) {
                    //保底服务费
                    var lowestCommission = parseInt(this.lowestCommission);
                    //已对账确认佣金
                    var confirmCommission = clueVM.confirmCommission;
                    var sum = commissionMoney + confirmCommission;
                    //如果已提交确认的佣金+ 此次结算金额算出来的佣金小于保底服务费 则佣金=保底服务费-已对账的佣金
                    //否则佣金等于结算金额*结算比例
                    if (lowestCommission > sum) {
                        clueVM.apply.commissionMoney = lowestCommission - confirmCommission;
                    } else {
                        clueVM.apply.commissionMoney = commissionMoney;
                    }
                }
            },
                toogleClick(){
                    if(this.isShow){
                        this.isShow=false
                    }else{
                        this.isShow=true
                    }
                },
                closeSubmitApplyDialog(){//关闭提交对账确认
                    clueVM.lowestCommissionShow = false;
                    // 点击关闭 数据重置
                    this.$refs['apply'].resetFields();
                },
                cancelSubmitApplyFrom(formName){//提交对账确认取消
                    this.submitApplyVisible= false;
                    clueVM.lowestCommissionShow = false;
                    // 点击取消 数据重置
                    this.$refs[formName].resetFields();
                },
                closeRejectDialog(){//关闭驳回
                    // 点击关闭 数据重置
                    this.$refs['rejectform'].resetFields();
                },
                cancelReconciliationFrom(formName){//取消驳回
                    this.rejectVisible = false;
                    // 点击取消 数据重置
                    this.$refs[formName].resetFields();
                },
                changeTeleDept(selectedValue){//电销事业部
                    this.clearTeleDeptList();
                    if(!selectedValue){
                        return;
                    }
                    var param ={};
                    param.id = selectedValue;
                    axios.post('/organization/organization/queryTeleGroupListByParentId', param)
                    .then(function (response) {
                          var result =  response.data;
                          var table=result.data;
                          clueVM.teleGorupOptions= table;
                    })
                    .catch(function (error) {
                         console.log(error);
                    });
                },
                clearTeleCompanyList(){
                    this.teleDeptOptions=[];
                    this.searchForm.teleDeptId='';
                    this.clearTeleDeptList();

                },
                clearTeleDeptList(){
                    this.teleGorupOptions=[];
                    this.searchForm.teleGorupId='';
                    this.clearTeleGroupList();

                },
                clearTeleGroupList(){
                     this.teleSaleOptions=[];
                     this.searchForm.teleSaleId='';
                },
                changeTeleGroup(selectedValue){//改变电销组
                    this.clearTeleGroupList();
                    if(!selectedValue){
                        return;
                    }
                    var param ={};
                    param.id = selectedValue;
                    axios.post('/organization/organization/queryTeleSaleByOrgId', param)
                    .then(function (response) {
                          var result =  response.data;
                          var table=result.data;
                          clueVM.teleSaleOptions= table;
                    })
                    .catch(function (error) {
                         console.log(error);
                    });
                },
                changeBusArea(selectedValue){//改变商务大区
                    this.clearBusAreaList();
                    if(!selectedValue){
                        return;
                    }
                    var param ={};
                    param.id = selectedValue;
                    axios.post('/organization/organization/queryBusGroupListByParentId', param)
                    .then(function (response) {
                          var result =  response.data;
                          var table=result.data;
                          clueVM.busGroupOptions= table;
                    })
                    .catch(function (error) {
                         console.log(error);
                    });
                },
                changeBusGroup(selectedValue){//改变商务组
                    this.clearBusGroupList();
                    if(!selectedValue){
                        return;
                    }
                    var param ={};
                    param.id = selectedValue;
                    axios.post('/organization/organization/queryBusManagerByOrgId', param)
                    .then(function (response) {
                          var result =  response.data;
                          var table=result.data;
                          clueVM.busSaleOptions= table;
                    })
                    .catch(function (error) {
                         console.log(error);
                    });
                },
                clearBusAreaList(){
                    this.busGroupOptions=[];
                    this.searchForm.busGroupId='';
                    this.clearBusGroupList();

                },
                clearBusGroupList(){
                     this.busSaleOptions=[];
                     this.searchForm.busSaleId='';
                },
                getBusAndTel(){
                	var param ={};
                	axios.post('/financing/balanceaccount/getBusAndTel', param)
                    .then(function (response) {
                          var result =  response.data;
                          clueVM.busSaleOptions= result.busSaleList;
                          clueVM.busGroupOptions = result.busGroupList;
                          clueVM.teleSaleOptions = result.teleSaleList;
                          clueVM.teleGorupOptions = result.teleGroupList;
                          clueVM.dxBusinessList = result.teleCompanyList;
                    })
                    .catch(function (error) {
                         console.log(error);
                    });
                },
              //级联查询机构
                showTele(type){
                    var param={};
                    if(type==1){
                        param.orgType="1";
                        param.parentId = this.searchForm.teleDeptId;
                        this.clearTeleDeptList();
                    }else if(type ==7){
                        param.orgType="7";
                        param.parentId = this.searchForm.teleCompanyId;
                        this.clearTeleCompanyList();
                    }else if(type ==0){
                        param.orgType="8";
                    }
                    param.businessLine = businessLine;
                    axios.post('/organization/organization/queryOrgByType',param).then(function (response) {
                        //    console.log(response);
                        if(type==1){
                        	clueVM.teleGorupOptions = response.data.data;
                        }else if(type ==7){
                        	clueVM.teleDeptOptions = response.data.data;
                        }else{
                        	clueVM.dxBusinessList = response.data.data;
                        }
                    }).catch(function (error) {
                        console.log(error);
                    })
                        .then(function () {
                            // always executed
                        });
                },

        },
        created(){
            console.info("create method");
            // 进入页面判断有是否有存储值
            if(!this.paginationShow){
                var storeVal = getSessionStore("balanceAccountStoreForm");
                var otherVal = getSessionStore("balanceAccountOtherVal");
                if(storeVal && otherVal){
                    this.searchForm = storeVal;
                    this.$set(this.pager,"currentPage",otherVal.currentPage);
                    this.storeId = otherVal.clueId;
                    this.scrollTop = otherVal.scrollTop;
                }
            };
            // 取页数存储
            var localVal=localStorage.getItem('allChangePageSize')?parseInt(localStorage.getItem('allChangePageSize')):'';
            if(localVal){this.pager.pageSize = localVal;}
            this.initColumn();
            this.searchTable();
         //   this.showTele(0);
            this.teleDeptOptions = teleDeptList;
            this.getBusAndTel();
        },
        mounted(){
           console.info("mounted method");
           document.getElementById('clueManage').style.display = 'block';
        }
    })

</script>
</html>